package org.classdef.analyzer.info.constant;

/**
 * 
 * 基本常量信息
 *
 */
public class Utf8Info extends ConstantInfo {

	private short length;
	private byte[] value;

	public Utf8Info(short tag, short length, byte[] value) {
		super(tag);
		this.length = length;
		this.value = value;
	}

	@Override
	public Object getValue() {
		return new String(value);
	}

	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append("{");
		sb.append("\"tag\":").append(tag);
		sb.append(",\"length\":").append(length);
		sb.append(",\"value\":\"").append(new String(value)).append("\"");
		sb.append("}");
		return sb.toString();
	}
}